package com.kyle.pagingdemo

import android.os.Bundle
import android.transition.TransitionInflater
import android.view.View
import androidx.fragment.app.Fragment
import com.bumptech.glide.Glide
import com.kyle.pagingdemo.databinding.FragmentImageBinding

/**
 * author: liliang
 * date: 4/24/21 8:52 AM
 * desc:
 */
class ImageFragment: Fragment(R.layout.fragment_image) {

    private lateinit var binding: FragmentImageBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val animation = TransitionInflater.from(requireContext()).inflateTransition(
            android.R.transition.move
        )
        sharedElementEnterTransition = animation
        sharedElementReturnTransition = animation
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding = FragmentImageBinding.bind(view)
        val url = arguments?.getString("url")
        Glide.with(binding.imageBig.context).load(url)
            .into(binding.imageBig)
    }
}